package com.tts.controller;

import com.tts.dto.ApiResponse;
import com.tts.entity.SystemLog;
import com.tts.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/logs")
public class LogController {

    @Autowired
    private LogService logService;

    @GetMapping
    public ApiResponse<Page<SystemLog>> getLogs(
            @RequestParam(required = false) String keyword,
            @RequestParam(required = false) String operation,
            @RequestParam(required = false) String startDate,
            @RequestParam(required = false) String endDate,
            Pageable pageable) {
        return ApiResponse.success(logService.getLogs(keyword, operation, startDate, endDate, pageable));
    }
} 